import Vue from 'vue'

import Cookies from 'js-cookie'

import 'normalize.css/normalize.css' // a modern alternative to CSS resets
import Element from 'element-ui'
import './assets/styles/element-variables.scss'
import VCharts from 'v-charts'

import App from './App'
import store from './store'
import router from './router'
// import permission from './directive/permission'

//打印测试组件
import Print from 'vue-print-nb'
// import Print from '@/utils/print'

import './assets/icons' // icon
import './permission' // permission control
import { parseTime, resetForm, addDateRange, selectDictLabel, download, handleTree, showDragView, closeDragView} from "@/utils/iboot";
import {formatTimeTotal} from '@/utils/index';
// import Pagination from "@/components/Pagination";
import '@/assets/styles/index.scss' // global css
import '@/assets/styles/iboot.scss' // iboot css

import common from "./mixins/common";
import pagination from "./mixins/pagination";
Vue.mixin(common);
Vue.mixin(pagination);


import {zhTran} from './utils/tran'
Vue.prototype.$zhTran = zhTran

// 全局方法挂载
Vue.prototype.parseTime = parseTime
Vue.prototype.resetForm = resetForm
Vue.prototype.addDateRange = addDateRange
Vue.prototype.selectDictLabel = selectDictLabel
Vue.prototype.download = download
Vue.prototype.handleTree = handleTree
Vue.prototype.showDragView = showDragView
Vue.prototype.closeDragView = closeDragView
Vue.prototype.formatTimeTotal = formatTimeTotal

Vue.prototype.msgSuccess = function (msg) {
  this.$message({ showClose: true, message: msg, type: "success" });
}

Vue.prototype.msgError = function (msg) {
  this.$message({ showClose: true, message: msg, type: "error" });
}

Vue.prototype.msgInfo = function (msg) {
  this.$message.info(msg);
}
Vue.prototype.msgWarn = function (msg) {
  this.$message({ showClose: true, message: msg, type: "warning" });
}

// 全局组件挂载
// Vue.component('Pagination', Pagination)

// Vue.use(permission)
Vue.use(Print);
Vue.use(VCharts);
/**
 * If you don't want to use mock-server
 * you want to use MockJs for mock api
 * you can execute: mockXHR()
 *
 * Currently MockJs will be used in the production environment,
 * please remove it before going online! ! !
 */

Vue.use(Element, {
  size: Cookies.get('size') || 'medium' // set element-ui default size
})

Vue.config.productionTip = false

new Vue({
  el: '#app',
  router,
  store,
  render: h => h(App)
})
